package com.nbsaas.boot.order.rest.resource;

import com.nbsaas.boot.order.api.apis.OrderPaymentApi;
import com.nbsaas.boot.order.data.entity.OrderPayment;
import com.nbsaas.boot.order.api.domain.request.OrderPaymentRequest;
import com.nbsaas.boot.order.api.domain.response.OrderPaymentResponse;
import com.nbsaas.boot.order.api.domain.simple.OrderPaymentSimple;
import com.nbsaas.boot.order.rest.convert.OrderPaymentSimpleConvert;
import com.nbsaas.boot.order.rest.convert.OrderPaymentEntityConvert;
import com.nbsaas.boot.order.rest.convert.OrderPaymentResponseConvert;
import com.nbsaas.boot.order.data.repository.OrderPaymentRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   订单支付-业务接口实现
*/
@Transactional
@Service
public class OrderPaymentResource extends BaseResource<OrderPayment,OrderPaymentResponse, OrderPaymentSimple, OrderPaymentRequest>  implements OrderPaymentApi {

    @Resource
    private OrderPaymentRepository orderPaymentRepository;

    @Override
    public JpaRepositoryImplementation<OrderPayment, Serializable> getJpaRepository() {
        return orderPaymentRepository;
    }

    @Override
    public Function<OrderPayment, OrderPaymentSimple> getConvertSimple() {
        return new OrderPaymentSimpleConvert();
    }

    @Override
    public Function<OrderPaymentRequest, OrderPayment> getConvertForm() {
        return new OrderPaymentEntityConvert();
    }

    @Override
    public Function<OrderPayment, OrderPaymentResponse> getConvertResponse() {
        return new OrderPaymentResponseConvert();
    }




}


